import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
import axios from "axios";
// import echarts from "echarts";

// Vue.use(echarts);
Vue.use(ElementUI);
Vue.config.productionTip = false;
axios.defaults.baseURL = ""; //请求地址
// 通过axios 请求拦截器添加token，保证拥有获取数据的权限
axios.interceptors.request.use((config) => {
  // 为请求头对象，添加token验证的Authorization
  console.log(config, "config");
  config.headers.Authorization = window.sessionStorage.getItem("token"); // 通过token来校验权限
  return config; // 添加之后return
});

Vue.prototype.$http = axios;

new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount("#app");
